/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Comic Sans MS', 'Yuanti SC', 'Yuanti SC Regular', 'YouYuan', '幼圆', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f0f8ff;
    background-image: linear-gradient(45deg, #f0f8ff 25%, #e6f3ff 25%, #e6f3ff 50%, #f0f8ff 50%, #f0f8ff 75%, #e6f3ff 75%, #e6f3ff 100%);
    background-size: 40px 40px;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 150, 0.1);
    margin-top: 20px;
    margin-bottom: 20px;
    border: 3px solid #ffc0cb;
}

/* 标题样式 */
header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    padding: 10px;
    background-color: #ffe6f2;
    border-radius: 15px;
    border: 2px dashed #ff80ab;
}

h1 {
    color: #ff6b88;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 2px;
}

h2 {
    color: #5c6bc0;
    font-size: 1.5rem;
    margin: 15px 0;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.score-container {
    position: absolute;
    top: 10px;
    right: 20px;
    background-color: #ffeb3b;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
    border: 2px solid #ffc107;
}

/* 游戏区域样式 */
.game-area {
    background-color: #e3f2fd;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #bbdefb;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    margin: 0 auto 20px;
    max-width: 300px;
}

.card {
    width: 120px;
    height: 180px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    position: relative;
    transition: transform 0.3s ease;
    border: 3px solid #ddd;
    background-size: cover;
    background-position: center;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* 操作区域样式 */
.operation-area {
    margin-top: 20px;
}

.answer-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.operator-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.op-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.2rem;
    background-color: #ffb74d;
    display: flex;
    justify-content: center;
    align-items: center;
}

input[type="text"] {
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid #bbdefb;
    font-size: 1rem;
    flex-grow: 1;
    min-width: 250px;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 8px rgba(100, 181, 246, 0.5);
}

button {
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    background-color: #64b5f6;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #42a5f5;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

#check-btn {
    background-color: #66bb6a;
}

#check-btn:hover {
    background-color: #4caf50;
}

#show-solution-btn {
    background-color: #ffb74d;
}

#show-solution-btn:hover {
    background-color: #ffa726;
}

.result-display {
    background-color: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    min-height: 60px;
    border: 2px dashed #bbdefb;
}

#result-message {
    font-weight: bold;
    text-align: center;
    font-size: 1.2rem;
}

#solution-display {
    margin-top: 10px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
    display: none;
}

/* 自定义输入区域样式 */
.custom-input-area {
    background-color: #e8eaf6;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #c5cae9;
}

.custom-input-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.custom-number-input, .custom-card-selection {
    background-color: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.custom-number-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

input[type="number"] {
    width: 60px;
    padding: 8px;
    border-radius: 10px;
    border: 2px solid #c5cae9;
    text-align: center;
    font-size: 1rem;
}

.card-selection-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.card-select {
    padding: 8px;
    border-radius: 10px;
    border: 2px solid #c5cae9;
    background-color: white;
}

#custom-solution-display {
    margin-top: 15px;
    padding: 15px;
    background-color: #fff;
    border-radius: 10px;
    min-height: 60px;
    border: 2px dashed #c5cae9;
    display: none;
}

/* 游戏规则样式 */
.instructions {
    background-color: #fff9c4;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    border: 2px dashed #fff176;
}

.instructions p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 15px;
    color: #7986cb;
    font-size: 1rem;
    margin-top: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .card {
        width: 100px;
        height: 150px;
    }
    
    .custom-input-options {
        flex-direction: column;
    }
    
    .custom-number-input, .card-selection-container {
        justify-content: center;
    }
}

/* 动画效果 */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.correct-answer {
    animation: bounce 0.5s ease 3;
    color: #4caf50;
}

.wrong-answer {
    color: #f44336;
}

/* 可爱元素 */
.card::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    z-index: -1;
}

button {
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    border-radius: 20px;
}
